﻿<script type="text/javascript">
    var toolbar_biaoduan = [{
        text: '新增桩号',
        iconCls: 'icon-add',
        handler: function() {
            $("#biaoduan-edit").dialog('open');
            $("#info-gonglihao1-luji").textbox('setValue', '');
            $("#info-dian1-luji").textbox('setValue', '');
            $("#info-gonglihao2-luji").textbox('setValue', '');
            $("#info-dian2-luji").textbox('setValue', '');
            $("#info-zuoyoufu").combobox('setValue', '');
            $("#info-biaoduankuandu").textbox('setValue', '');
            $("#info-biaoduanhoudu").textbox('setValue', '');
            $("#info-zhandian-luji").combobox('setValue', '');
            var d = new Date();
            $("#info-riqi-luji").datebox('setValue', d.toLocaleDateString());
            $("#biaoDuanID").val('');
        }
    }, '-', {
        text: '修改桩号',
        iconCls: 'icon-edit',
        handler: function() {
            var curRow = $("#xinxi_biaoduan").datagrid('getSelected');
            if (curRow) {
                $("#biaoduan-edit").dialog('open');
                $("#info-gonglihao1-luji").textbox('setValue', curRow.gonglihao1);
                $("#info-dian1-luji").textbox('setValue', curRow.dian1);
                $("#info-gonglihao2-luji").textbox('setValue', curRow.gonglihao2);
                $("#info-dian2-luji").textbox('setValue', curRow.dian2);
                $("#info-zuoyoufu").combobox('setValue', curRow.zuoyoufu);
                $("#info-biaoduankuandu").textbox('setValue', curRow.biaoduankuandu);
                $("#info-biaoduanhoudu").textbox('setValue', curRow.biaoduanhoudu);
                $("#info-gongcheng-luji").textbox('setValue', curRow.gongcheng);
                $("#info-riqi-luji").datebox('setValue', curRow.riqi);
                $("#info-ganmidu-luji").textbox('setValue', curRow.ganmidu);
                $("#info-zhandian-luji").combobox('setValue', curRow.zhandian);
                $("#biaoDuanID").val(curRow.id);
            }
            else {
                alert("请选择要修改的标段信息。");
            }
        }
    }, '-', {
        text: '删除桩号',
        iconCls: 'icon-remove',
        handler: function() {
            $("#biaoduan-dlg").dialog('open');
        }
}];

        function DelBiaoDuan() {
            var curRow = $("#xinxi_biaoduan").datagrid('getSelected');
            if (curRow) {
                $.post('handler/xinxi_biaoduan.ashx', { biaoDuanType: "3", biaoDuanID: curRow.id, biaoDuanLeiXing: "路基",uid:window.uid,kid:window.kid }, function(data, status) {
                    if (data == "OK") {
                        $("#biaoduan-dlg").dialog('close');
                        $("#xinxi_biaoduan").datagrid('load');
                        return;
                    }
                    if (data == "Failed") {
                        alert("删除标段信息失败，请重试");
                        $("#biaoduan-dlg").dialog('close');
                        return;
                    }
                    alert(data);
                    $("#biaoduan-dlg").dialog('close');
                });
            }
            else {
                alert("请选择要删除的标段信息。");
            }
        }
        
        function submitBiaoDuanForm() {
            var gonglihao1 = $("#info-gonglihao1-luji").textbox('getText');
            var gonglihao2 = $("#info-gonglihao2-luji").textbox('getText');
            var dian1 = $("#info-dian1-luji").textbox('getText');
            var dian2 = $("#info-dian2-luji").textbox('getText');
            var riqi = $("#info-riqi-luji").datebox('getValue');
            var gongcheng = $("#info-gongcheng-luji").combobox('getText');
            var ganmidu = $("#info-ganmidu-luji").textbox('getText');
            var kuandu = $("#info-biaoduankuandu").textbox('getText');
            var houdu = $("#info-biaoduanhoudu").textbox('getText');
            var zuoyoufu = $("#info-zuoyoufu").combobox('getText');
            var biaoduanid = $("#biaoDuanID").val();
            var zhandian = $("#info-zhandian-luji").combobox('getText');
            if (zhandian&&gonglihao1 && gonglihao2 && dian1 && dian2 && riqi && gongcheng && ganmidu && kuandu && houdu) {
                $.post('handler/xinxi_biaoduan.ashx', { uid: window.uid, kid: window.kid, biaoDuanType: '2', biaoDuanLeiXing: '路基',zhandian:zhandian, biaoDuanID: biaoduanid, gonglihao1: gonglihao1, gonglihao2: gonglihao2, dian1: dian1, dian2: dian2, kuandu: kuandu, houdu: houdu, zuoyoufu: zuoyoufu, gongcheng: gongcheng, ganmidu: ganmidu, riqi: riqi }, function (data, status) {
                    if (data == "OK") {
                        $("#biaoduan-edit").dialog('close');
                        $("#xinxi_biaoduan").datagrid('load');
                        return;
                    }
                    if (data == "Failed") {
                        alert("保存标段信息失败，请重试");
                        return;
                    }
                });
            }
            else {
                alert("信息不完整，请检查后重试。");
            }
        }

        function clearBiaoDuanForm() {
            $("#biaoduan-edit").dialog('close');
        }

    $("#chaxun-luji").click(function() {
        $("#xinxi_biaoduan").datagrid('load', {zhandian:$("#zhandian-luji").combobox('getText'), biaoDuanType: '1', biaoDuanLeiXing: '路基', riQiKaiShi: $("#riqi-luji-kaishi").datebox('getValue'), riQiJieShu: $("#riqi-luji-jieshu").datebox('getValue'), uid: window.uid, kid: window.kid });
    });

    $.parser.onComplete = function () {
        var d = new Date();
        $("#riqi-luji-kaishi").datebox('setValue', d.toLocaleDateString());
        $("#riqi-luji-jieshu").datebox('setValue', d.toLocaleDateString());

        $("#zhandian-luji").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 200,
            panelHeight: 'auto',
            editable: false,
            onLoadSuccess: function () {
                $("#xinxi_biaoduan").datagrid({
                    url: 'handler/xinxi_biaoduan.ashx', method: 'post', queryParams: { zhandian: $("#zhandian-luji").combobox('getText'), biaoDuanType: '1', biaoDuanLeiXing: '路基', riQiKaiShi: $("#riqi-luji-kaishi").datebox('getValue'), riQiJieShu: $("#riqi-luji-jieshu").datebox('getValue'), uid: window.uid, kid: window.kid }, onSelect: function (index, row) {
                        $("#biaoDuanID").val(row.id);
                    }
                });
            }
        });

        $("#info-gongcheng-luji").combobox({
            url: 'handler/xinxi_zidian.ashx',
            method:'post',
            queryParams: { ziDianType: 1, fenZu: '路基', uid: window.uid, kid: window.kid }
        });

        $("#info-zhandian-luji").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 200,
            panelHeight: 'auto',
            editable: false,
            loadFilter: function (data) {
                var returnData = [];
                for (var i = 0; i < data.length; i++) {
                    if (data[i].zhandian != "—全部—") {
                        returnData.push(data[i]);
                    }
                }
                return returnData;
            }
        });

    }
            
</script>

<div class="easyui-panel" data-options="height:90,border:false" title="数据检索" style="border-top-width: 0px;border-bottom-width: 1px; padding: 15px;width:100%">
    <table style="font-size: 12px;">
        <tr>
            <td>
                站点：
            </td>
            <td>
                <input name="zhandian-luji" id="zhandian-luji" style="width: 175px;" />
            </td>
            <td>
                开盘日期：
            </td>
            <td>
                <input id="riqi-luji-kaishi" type="text" class="easyui-datebox" data-options="required:true"
                    style="width: 175px">
            </td>
            <td>
                至
            </td>
            <td>
                <input id="riqi-luji-jieshu" type="text" class="easyui-datebox" data-options="required:true"
                    style="width: 175px">
            </td>
            <td>
                <a id="chaxun-luji" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                    style="width: 60px; margin-left: 20px;">查询</a>
            </td>
        </tr>
    </table>
</div>

<table id="xinxi_biaoduan" style="width: 100%" class="easyui-datagrid" title="施工段落——路基"
    data-options="border: false, singleSelect: true, collapsible: false, striped: true, toolbar: toolbar_biaoduan">
    <thead>
        <tr>
            <th data-options="field:'gongcheng',width:110">
                分项工程
            </th>
            <th data-options="field:'kaipanriqi',width:90">
                开盘日期
            </th>
            <th data-options="field:'biaoduanmingcheng',width:200">
                桩号
            </th>
            <th data-options="field:'biaoduanchangdu',width:100">
                长度(米)
            </th>
            <th data-options="field:'biaoduankuandu',width:100">
                宽度(米)
            </th>
            <th data-options="field:'biaoduanhoudu',width:100">
                厚度(米)
            </th>
            <th data-options="field:'zuoyoufu',width:100">
                左右幅
            </th>
            <th data-options="field:'ganmidu',width:120">
                最大干密度(t/m³)
            </th>
            <th data-options="field:'fangliang',width:100">
                设计方量(m³)
            </th>
            <th data-options="field:'jihualiang',width:100">
                设计重量(t)
            </th>
            <th data-options="field:'id',hidden:true">
                编号
            </th>
            <th data-options="field:'zhandian',hidden:true">
                站点
            </th>
        </tr>
    </thead>
</table>

<div id="biaoduan-edit" class="easyui-dialog" title="路基信息编辑" data-options="modal:true,closed:true,iconCls:'icon-edit',draggable:false,collapsible:false,minimizable:false,maximizable:false,resizable:false"
    style="width: 500px; height: 400px; padding: 10px;">
    <div style="width: 350px; margin: 0 auto;">
        <table cellpadding="5" style="font-size: 13px; margin: 0 auto; padding-top: 20px">
            <tr>
                <td>
                    站点：
                </td>
                <td>
                    <input class="easyui-combobox" name="info-zhandian-luji" id="info-zhandian-luji" data-options="width:200, panelHeight: 'auto',editable:true,valueField:'xiangmu',textField:'xiangmu'">
                    </input>
                </td>
            </tr>
            <tr>
                <td>
                    分项工程：
                </td>
                <td>
                    <input class="easyui-combobox" name="info-gongcheng-luji" id="info-gongcheng-luji" data-options="width:200, panelHeight: 'auto',editable:true,valueField:'xiangmu',textField:'xiangmu'">
                    </input>
                </td>
            </tr>
              <tr>
                <td>
                    开盘日期：
                </td>
                <td>
                    <input id="info-riqi-luji" name="info-riqi-luji" type="text" class="easyui-datebox" data-options="width:200" />
                </td>
            </tr>
            <tr>
                <td>
                    桩号:
                </td>
                <td>
                    K<input class="easyui-textbox" type="text" id="info-gonglihao1-luji" name="info-gonglihao1-luji"
                        data-options="width:50"></input>
                    <input class="easyui-textbox" type="text" id="info-dian1-luji" name="info-dian1-luji"
                        data-options="width:50"></input>- K<input class="easyui-textbox" type="text" id="info-gonglihao2-luji"
                            name="info-gonglihao2-luji" data-options="width:50"></input>
                    <input class="easyui-textbox" type="text" id="info-dian2-luji" name="info-dian2-luji"
                        data-options="width:50"></input>
                </td>
            </tr>
            <tr>
                <td>
                    宽度(米):
                </td>
                <td>
                    <input class="easyui-textbox" type="text" id="info-biaoduankuandu" name="info-biaoduankuandu"
                        data-options="width:200"></input>
                </td>
            </tr>
            <tr>
                <td>
                    厚度(米):
                </td>
                <td>
                    <input class="easyui-textbox" type="text" id="info-biaoduanhoudu" name="info-biaoduanhoudu"
                        data-options="width:200"></input>
                </td>
            </tr>
            <tr>
                <td>
                    左右幅:
                </td>
                <td>
                    <select class="easyui-combobox" name="info-zuoyoufu" id="info-zuoyoufu" data-options="width:200, panelHeight: 'auto',editable:false">
                        <option value="">—请选择—</option>
                        <option value="全幅">全幅</option>
                        <option value="左半幅">左半幅</option>
                        <option value="右半幅">右半幅</option>
                    </select>
                </td>
            </tr>
             <tr>
                <td>
                   最大干密度:
                </td>
                <td>
                    <input class="easyui-textbox" type="text" id="info-ganmidu-luji" name="info-ganmidu-luji"
                        data-options="width:200"></input>
                </td>
            </tr>
        </table>
        <input type="hidden" name="biaoDuanID" id="biaoDuanID" value="" />
        <div style="text-align: center; padding: 5px">
            <a href="javascript:void(0)" class="easyui-linkbutton" style="width: 75px" onclick="submitBiaoDuanForm()"
                data-options="iconCls:'icon-ok'">保存</a> <a href="javascript:void(0)" class="easyui-linkbutton"
                    style="width: 75px" onclick="clearBiaoDuanForm()" data-options="iconCls:'icon-cancel'">
                    关闭</a>
        </div>
    </div>
</div>
<div id="biaoduan-dlg" class="easyui-dialog" title="删除确认" style="width: 300px; height: 150px;
    padding: 10px" data-options="iconCls: 'icon-help',buttons: '#biaoduan-dlg-buttons',modal:true,closed:true">
    确定要删除该路基信息吗？
</div>
<div id="biaoduan-dlg-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:DelBiaoDuan();">
        确定</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#biaoduan-dlg').dialog('close')">
            取消</a>
</div>
